#include <logbase.h>
#include <genrand.h>
#include <pthread.h>
#include <taskMgr.h>

void checkFunction1()
{
    logdebugc("");
}
void checkFunction2()
{
    logdebugc("");
}
void checkFunction3()
{
    logdebugc("");
}

struct taskDef checkTaskList[] = 
{
    TASK_DEFINE(NULL, checkFunction1, NULL, 1000),
    TASK_DEFINE(NULL, checkFunction2, NULL, 2000),
    TASK_DEFINE(NULL, checkFunction3, NULL, 5000),
};

struct taskManageDef checkTaskMng = {checkTaskList, ARRAY_LEN(checkTaskList), 0};
int main(int argc, char **argv)
{
    schedulerInit(&checkTaskMng);
    while(1)
    {
        schedulerRun(&checkTaskMng);
        usleep(20000);// sleep 20ms
    }
    schedulerQuit(&checkTaskMng);
    return 1;
}

// 不用锁就会有2线程数据不一致情况。用valotile没有用的。
// [2023-12-13 15:52:03.269][dbg][cthread.c,18]functionThread, value=897
// [2023-12-13 15:52:03.298][dbg][cthread.c,18]functionThread, value=898
// [2023-12-13 15:52:03.870][dbg][cthread.c,36]main, value=111
// [2023-12-13 15:52:03.337][dbg][cthread.c,36]main, value=899
// [2023-12-13 15:52:03.348][dbg][cthread.c,36]main, value=900
